#include <fstream>
#include <thread>
#include "Foundation/Foundation.h"
#include "String/String.h"
#include "PocoLoggerTest.h"

using namespace SystemTool;

void PocoLoggerTest()
{
    INIT_FILE_SYS_LOGGER("TestA", "/Users/tangyingzhong/Desktop/Sys1.log");
    INIT_FILE_SYS_LOGGER("TestB", "/Users/tangyingzhong/Desktop/Sys1.log");
    INIT_FILE_SYS_LOGGER("TestC", "/Users/tangyingzhong/Desktop/Sys3.log");
    INIT_FILE_SYS_LOGGER("TestD", "/Users/tangyingzhong/Desktop/Sys4.log");

    LOG_DEBUG("TestA",String("Where are you go %s with %d people").Args("Tom's Home").Args(6).Data());
    LOG_ERROR("TestA",String("我是大哥 %s with %d days").Args("Winnie").Args(30).Data());
    LOG_INFO("TestA",String("我是大哥 %s with %d days").Args("Winnie").Args(30).Data());
    LOG_WARN("TestA",String("我是大哥 %s with %d days").Args("Winnie").Args(30).Data());

    std::thread t=std::thread([](){
        LOG_DEBUG("TestB",String("B print to A's file %s with %d days").Args("yes").Args(30).Data());
        LOG_DEBUG("TestB",String("I love %s with %d days").Args("B").Args(30).Data());
    });
    // std::this_thread::sleep_for(std::chrono::milliseconds(2000));
    if(t.joinable())
    {
        t.join();
    }
    
    LOG_DEBUG("TestC",String("I love %s with %d days").Args("C").Args(30).Data());
    LOG_DEBUG("TestD",String("I love %s with %d days").Args("D").Args(30).Data());

    INIT_CONSOLE_SYS_LOGGER("Con1");
    LOG_DEBUG("Con1",String("I love %s with %d days").Args("D").Args(30).Data());
}
